home *** CD-ROM | disk | FTP | other *** search
- /*
- File: ShapeUIWin.c
-
- Copyright 1991-96 by Adobe Systems, Inc.
-
- C source file for Windows specific code for Selection example.
- */
-
- #include "Shape.h"
- #include "WinDialogUtils.h"
-
- /*****************************************************************************/
-
- BOOL WINAPI SelectionProc(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM lParam); // Win32 Change
- short ShowAlert (short stringID);
-
- /*****************************************************************************/
-
- void DoAbout (GPtr globals)
- {
- ShowAbout((AboutRecordPtr)gStuff, hDllInstance, AboutID);
- }
-
- /****************************************************************************/
- /* Example for ShowAlert() function which takes a string ID as parameter */
- /* and displays a message box */
- /****************************************************************************/
-
- short ShowAlert (short stringID)
- {
- char szMessage[256];
- char szTitle[128];
-
- LoadString(hDllInstance, stringID, szMessage, sizeof szMessage);
- LoadString(hDllInstance, 2, szTitle, sizeof szTitle);
- return ( MessageBox(NULL, szMessage, szTitle, MB_OK | MB_ICONHAND) );
-
- }
-
- /*****************************************************************************/
-
- BOOL WINAPI SelectionProc(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM lParam) // Win32 Change
- {
- int idd; // WIN32 Change
- static GPtr globals=NULL; /* need to be static */
-
- switch (wMsg)
- {
-
- case WM_INITDIALOG:
-
- /* set up globals */
- globals = (GPtr) lParam;
-
- CenterDialog(hDlg); // CenterWindow(hDlg, CW_BOTH);
-
- SetRadioGroupState(hDlg,
- kFirstItem,
- kLastItem,
- kFirstItem + gWhatShape);
- SetRadioGroupState(hDlg,
- kCreateRadio1,
- kCreateRadioLast,
- kCreateRadio1 + gCreate);
- /* fall into WM_PAINT */
- case WM_PAINT:
- return FALSE;
- break;
-
- case WM_COMMAND:
- idd = COMMANDID (wParam); // WIN32 Change
- if (idd >= kFirstItem && idd <= kLastItem)
- SetRadioGroupState(hDlg, kFirstItem, kLastItem, wParam);
- else if (idd >= kCreateRadio1 && idd <= kCreateRadioLast)
- SetRadioGroupState(hDlg, kCreateRadio1, kCreateRadioLast, wParam);
- else
- {
- switch (idd)
- {
- case ok:
- gWhatShape = GetRadioGroupState(hDlg, kFirstItem, kLastItem)
- - kFirstItem;
- gCreate = GetRadioGroupState(hDlg, kCreateRadio1, kCreateRadioLast)
- - kCreateRadio1;
- EndDialog(hDlg, idd);
- break;
- case cancel:
- gResult = userCanceledErr;
- EndDialog(hDlg, idd); // WIN32 change
- break;
- default:
- return FALSE;
- break;
- }
- }
- break;
- default:
- return FALSE;
- break;
- }
- return TRUE;
- }
-
- /*****************************************************************************/
- Boolean DoParameters (GPtr globals)
- {
-
- int nResult = noErr;
- PlatformData *platform;
-
- platform = ((SelectionRecordPtr) gStuff)->platformData;
-
- /* Query the user for parameters. */
-
- nResult = DialogBoxParam(hDllInstance,
- (LPSTR)"SELECTIONPARAM",
- (HWND)platform->hwnd,
- (FARPROC)SelectionProc,
- (LPARAM)globals);
-
- return (nResult == true); // could be -1
- }
-
- /*****************************************************************************/
-
- /* Initialization and termination code for window's dlls. */
-
- // Win32 Change
- #ifdef WIN32
-
- // Every 32-Bit DLL has an entry point DLLInit
-
- BOOL APIENTRY DLLInit(HANDLE hInstance, DWORD fdwReason, LPVOID lpReserved)
- {
-
- if (fdwReason == DLL_PROCESS_ATTACH)
- hDllInstance = hInstance;
-
- return TRUE; // Indicate that the DLL was initialized successfully.
- }
-
- #else
- /* ------------------------------------------------
- * Code from Borland's window's dll example code.
- * ------------------------------------------------
- */
- #if defined(__BORLANDC__)
- // Turn off warning: Parameter '' is never used; effects next function only
- #pragma argsused
- #endif
-
- // Every DLL has an entry point LibMain and an exit point WEP.
- int FAR PASCAL LibMain( HANDLE hInstance, WORD wDataSegment,
- WORD wHeapSize, LPSTR lpszCmdLine )
- {
- // Required when using Zortech; causes blink to include startup code
- extern __acrtused_dll;
-
- // The startup code for the DLL initializes the local heap (if there is one)
- // with a call to LocalInit which locks the data segment.
- if ( wHeapSize != 0 )
- UnlockData( 0 );
-
- hDllInstance = hInstance;
- return 1; // Indicate that the DLL was initialized successfully.
- }
-
- int FAR PASCAL WEP(int nParam)
- {
- switch (nParam) {
- case WEP_SYSTEM_EXIT: // System shutdown in progress
- case WEP_FREE_DLL : // DLL use count is 0
- default : // Undefined; ignore
- return 1;
- }
- }
- #endif
-